#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
/*********Begin*********/
struct student {
    long num;
    char name[20];
    float score;
};
void print(struct student st[], int n) {
    for (int i = 0; i < n - 1; i++) {
        for (int j = i + 1; j < n; j++) {
            if (st[i].score < st[j].score) {
                struct student t = st[i];
                st[i] = st[j];
                st[j] = t;
            }
        }
    }
    for (int i = 0; i < n; i++) {
        printf("%ld %s %g\n", st[i].num, st[i].name, st[i].score);
    }
}

/*********End**********/
int main(void)
{
    /*********Begin*********/
    int n;
    scanf("%d", &n);
    struct student st[100];
    for (int i = 0; i < n; i++) {
        scanf("%ld %s %f", &st[i].num, st[i].name, &st[i].score);
    }
    print(st, n);
    /*********End**********/
    return 0;
}